package com.powernode.goods.controller;

import com.powernode.goods.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private OrderService orderService;

    /**
     * 下单的web接口
     * @param goodsId 商品的id
     * @param num  购买商品数量
     * @return
     */
    @GetMapping("/submit/{goodsId}/{num}")
    public String submit(@PathVariable("goodsId") Long goodsId,
                         @PathVariable("num")Integer num) {
        return orderService.submit(goodsId,num);
    }
}
